﻿using CommunityToolkit.Mvvm.ComponentModel;

namespace AvaloniaApplicationDemo.Models;

/// <summary>
/// 从站信息业务模型类
/// 专注于业务逻辑，不参与UI绑定
/// 与 SlaveInfoDto 分离，确保数据隔离
/// </summary>
public class SlaveInfo
{
    /// <summary>
    /// 设备IP地址
    /// </summary>
    public string IpServer { get; set; }

    /// <summary>
    /// 设备端口号
    /// </summary>
    public int PortServer { get; set; }

    /// <summary>
    /// TCP连接超时时间(毫秒)
    /// </summary>
    public int TcpTimeout { get; set; }

    /// <summary>
    /// 从站ID (1-247)
    /// </summary>
    public byte SlaveId { get; set; }

    /// <summary>
    /// 起始寄存器地址
    /// </summary>
    public ushort StartAddress { get; set; }

    /// <summary>
    /// 读取寄存器数量 (1-30)
    /// </summary>
    public ushort Quantity { get; set; }

    /// <summary>
    /// 数据采集间隔时间(毫秒)
    /// </summary>
    public int? IntervalTime { get; set; }

    /// <summary>
    /// 默认构造函数
    /// </summary>
    public SlaveInfo()
    {
        IpServer = "192.168.3.223";
        PortServer = 8010;
        TcpTimeout = 5000;
        SlaveId = 1;
        StartAddress = 0;
        Quantity = 30;
        IntervalTime = 2000;
    }
}
